package org.yx.service.sbas.view_supplier_roster;

import org.dbist.dml.Page;
import org.dbist.dml.Query;
import org.yx.models.SbasSupDef;
import org.yx.utils.BaseService;

import com.xiaoleilu.hutool.util.StrUtil;

/**
 * 查询供应商信息
 * @author zxw
 * @since 2018/03/27
**/
public class SbasViewSupplierRosterService extends BaseService {
	public SbasViewSupplierRosterOut viewSupplierRoster(SbasViewSupplierRosterIn in) throws Exception {
		Query query = new Query(in.getPageIndex(), in.getPageSize());
		query.addFilter("orgCode", in.getUserOrgCode());
		query.addFilter("status", "<>", 'D');
		if (!StrUtil.isBlank(in.getSupCode())) {
			query.addFilter("supCode", "like", in.getSupCode() + "%");
		}

		Page<SbasSupDef> supPage = selectPage(SbasSupDef.class, query);

		SbasViewSupplierRosterOut out = new SbasViewSupplierRosterOut();
		out.setTotalSize(supPage.getTotalSize());
		out.setSupplierList(supPage.getList());

		return out;
	}
}